const path = require('path');
const webpack = require('webpack');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

module.exports = {
  entry: [
    'react',
    'react-dom',
    'react-router-dom',
    'react-redux',
    'redux',
    'axios',
    'openlayers',
    'gsap',
    'javascript-blowfish',
    'react-draggable',
    'smooth-scrollbar',
    'react-smooth-scrollbar',
    // 'moment'
  ],
  output: {
    path: path.join(__dirname, '../dll'),
    filename: 'vendor.dll.[hash].js',
    library: 'vendor_[hash]'
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    }),
    new UglifyJsPlugin({
      compress: {
        warnings: false,
        drop_console: true,
        comparisons: false,
      },
      mangle: {
        safari10: true,
      },
      output: {
        comments: false,
        // Turned on because emoji and regex is not minified properly using default
        // https://github.com/facebookincubator/create-react-app/issues/2488
        ascii_only: true,
      },
    }),
    new webpack.optimize.ModuleConcatenationPlugin(),
    new webpack.DllPlugin({
      name: 'vendor_[hash]',
      path: path.join(__dirname, '../dll/manifest.json')
    })
  ]
}